using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;


namespace KineBall
{
    public class KineBall : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;

#if !NOKINECT
        KinectManager kinect;
#endif

        public KineBall()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferMultiSampling = true;
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            graphics.IsFullScreen = true;
            graphics.ApplyChanges();

#if !NOKINECT
            kinect = new KinectManager(this);
#endif

            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            // KinectManager initialization
#if !NOKINECT
            kinect.Initialize();
#endif

            // SoundManager initialization
            SoundManager.Initialize(this, "Sounds");
            SoundManager.LoadSound("BallCatched");
            SoundManager.LoadSound("BallLost");
            SoundManager.LoadSound("Bounce");

            this.onStart();
            base.Initialize();
        }

        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

#if !NOKINECT
            kinect.Update(gameTime);
#endif

            base.Update(gameTime);
        }
    }
}
